/* Controller Program(Eclipse SWT)
 * Written by Seung Il Moon (simoon@networking.khu.ac.kr)
 * 2011.01.04
 */

package net.m2m.policyeditor.controller;

import net.m2m.policyeditor.model.PolicyListMnanager;
import net.m2m.policyeditor.view.PEmakeShell;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;


public class CreatePolicyEvent {
	private PEmakeShell PEmkShell;
	private PolicyListMnanager PCListManager;
	private SelectionListener selectBtCreate;
	
	public CreatePolicyEvent(PolicyListMnanager PCListManager, PEmakeShell PEmkShell) {
		this.PCListManager = PCListManager;
		this.PEmkShell = PEmkShell;				
	}
	
	public SelectionListener SelectEventBtCreate() {		
		selectBtCreate = new SelectionListener() {			
			@Override
			public void widgetSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				PCListManager.InsertM2MPolicy();
	//			PCListManager.CreatePolicy();
				//PCListManager.InsertM2Mevent();
//				PCListManager.InsertM2MNetworkConfiguration();
				//PCListManager.InsertM2MDeviceConfiguration();
//				PCListManager.InsertM2MServiceArgument();
				
//				System.out.println("[widgetSelected]Button Create Clicked!!");
		//		System.out.println("Policy Name : " + PEmkShell.getPeForm().gettPolicyName().getText());
			}
			
			@Override
			public void widgetDefaultSelected(SelectionEvent e) {
				// TODO Auto-generated method stub
				System.out.println("[widgetDefaultSelected]Button Create Clicked!!");
			}
		};		
		return selectBtCreate;
	}

}
